## DESCRIPTION
## Multivariable differential calculus: interactive graph of 3D function in rectangular coordinates
## ENDDESCRIPTION

## KEYWORDS('multivariable differential calculus', '3D graph', 'rectangular coordinates')

## DBsubject('WeBWorK')
## DBchapter('WeBWorK Tutorial')
## DBsection('Fort Lewis Tutorial 2011')
## Date('01/30/2011')
## Author('Paul Pearson')
## Institution('Fort Lewis College')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')


####################################
#  Initialization

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserPopUp.pl",
"LiveGraphicsRectangularPlot3D.pl",
);

TEXT(beginproblem());


##################################
#  Set-up

Context("Numeric");

Context()->variables->are(x=>"Real",y=>"Real",r=>"Real",s=>"Real",t=>"Real");

$a = - random(-1,1,2);

$plot = RectangularPlot3DRectangularDomain(
function => Formula("t^2+$a*s^2"),
xvar => "s",
yvar => "t",
xmin => -2,
xmax =>  2,
ymin => -2,
ymax =>  2,
xsamples => 10,
ysamples => 10,
axesframed => 1,
xaxislabel => "S",
yaxislabel => "T",
zaxislabel => "Z",
outputtype => 4,
);

if ( $a == -1) {
  $im = "hyperbolic-paraboloid.png";
  $pop = PopUp(
     ["Choose","Paraboloid","Hyperbolic paraboloid"],
     "Hyperbolic paraboloid");
} else {
  $im = "paraboloid.png";
  $pop = PopUp(
     ["Choose","Paraboloid","Hyperbolic paraboloid"],
     "Paraboloid");
}


####################################
#  Main text

Context()->texStrings;
BEGIN_TEXT
The graph below is called a 
\{ $pop->menu() \}
$PAR
$BCENTER
\{ 
Live3Ddata(
$plot,
image => $im, 
size => [400,400],
tex_size => 600,
tex_center => 1,
scale => 1.1,
);
\}
$ECENTER
END_TEXT
Context()->normalStrings;


#####################################
#  Answer evaluation

$showPartialCorrectAnswers = 1;

ANS( $pop->cmp() );


#####################################
#  Solution

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT("MathObject version.");

ENDDOCUMENT();
